
{% extends "zato/index.html" %}

{% block html_title %}Publish message{% endblock %}

{% block "extra_css" %}
    <link rel="stylesheet" type="text/css" href="/static/css/jquery.alerts.css">
{% endblock %}

{% block "extra_js" %}

    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/js/common.js"></script>
    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/jquery/jquery.cookie.js"></script>
    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/jquery/jquery.form.js"></script>

    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/js/pubsub/message-publish.js"></script>

{% endblock %}

{% block "content" %}

<div id="user-message-div" style='display:none'><pre id="user-message" class="user-message"></pre></div>

<h2 class="zato">Publish a message</h2>


<div id="user-message-div" style='display:none'><pre id="user-message" class="user-message"></pre></div>

<div id="markup">
    <form novalidate id="message-publish-form" action="" method="post">
        <table id="data-table">
            <tr>
                <td class='inline_header' style="width:80px">
                    Topic
                </td>
                <td style="width:140px">
                    {{ form.topic_name }}
                </td>

                <td class='inline_header' style="width:90px">
                    Publisher
                </td>
                <td style="width:170px">
                    {{ form.publisher_id }}
                </td>

                <td style="width:90px"></td>
                <td>
                </td>
            </tr>
            <tr>
                <td class='inline_header' style="width:90px">
                    Guaranteed delivery
                </td>
                <td style="width:120px">
                    {{ form.gd }}
                </td>

                <td class='inline_header' style="width:90px">Priority <span class="form_hint">(1-9, 1=min)</span></td>
                <td>
                    {{ form.priority }}
                </td>

                <td style="width:90px"></td>
                <td style="width:140px"></td>
            </tr>
            <tr>
                <td class='inline_header' style="width:80px">Msg ID</td>
                <td style="width:120px">{{ form.msg_id }}</td>

                <td class='inline_header' style="width:90px">Expiration <span class="form_hint">(in seconds)</span></td>
                <td style="width:140px">{{ form.expiration }}</td>

                <td style="width:90px"></td>
                <td style="width:140px">
                </td>

            </tr>
            <tr>
                <td class='inline_header' style="width:80px">Correlation ID</td>
                <td style="width:120px">
                    {{ form.correl_id }}
                </td>

                <td class='inline_header' style="width:90px">External client ID</td>
                <td style="width:170px">{{ form.ext_client_id }}</td>

                <td style="width:90px"></td>
                <td style="width:140px"></td>

            </tr>
            <tr>
                <td class='inline_header' style="width:80px">In reply to msg ID</td>
                <td style="width:120px">
                    {{ form.in_reply_to }}
                </td>

                <td class='inline_header' style="width:90px">
                    Reply to sub key
                    <br/>
                    <br/>
                    Deliver to sub key
                </td>
                <td style="width:30%">
                    {{ form.reply_to_sk }}
                    <br/>
                    {{ form.deliver_to_sk }}
                </td>

                <td style="width:90px">
                    {% if object_type == "queue" %}
                        Delivery history
                    {% endif %}
                </td>
                <td style="width:140px">
                    {% if object_type == "queue" %}
                        <a href="#">Show</a>
                    {% endif %}
                </td>
            </tr>
            <tr>
            <tr>
                <td class='inline_header' colspan="6">
                    Data to send ↓
                </td>
            </tr>
            <tr>
                <td colspan="6"><textarea style="height:200px" id="data-textarea" name="data">{{ default_message }}</textarea></td>
            </tr>
            <tr>
                <td colspan="6" style="text-align:right">
                    <input type="submit" name="update-message-button" value="Publish to topic" />
                    {% csrf_token %}
                    <input type="hidden" name="cluster_id" id="cluster_id" value="{{ cluster_id }}" />
                    {{ form.select_changer_source }}
                </td>
            </tr>
        </table>
    </form>
</div>

{% endblock %}
